package com.lagou.controller;

import com.lagou.pojo.Article;
import com.lagou.reposity.ArticleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.persistence.Access;
import java.util.List;

@Controller
public class TestController {

    @Autowired
    ArticleRepository articleRepository;

    @RequestMapping("/toIndex")
    public String toIndexHtml(Model model){
        System.out.println("------come in-----");
        List<Article> all = articleRepository.findAll();
        model.addAttribute("allList",all);

        return "index";
    }
}
